---
layout: "default"
title: "Operator: prefix -"
description: "Swift documentation for the 'prefix -' operator."
root: "/v4.2"
---

<code class="language-swift"> operator prefix - {
    associativity 
    precedence 
}</code>

<h3>Declarations</h3>

<div class="declaration" id="func-mns_-double">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-mns_-double">prefix func -(<wbr>_: Double)</a>
        
<div class="comment collapse" id="comment-func-mns_-double"><div class="p">
    <p>Calculates the additive inverse of a value.</p>

<p>The unary minus operator (prefix <code>-</code>) calculates the negation of its
operand. The result is always exact.</p>

<pre><code class="language-swift">let x = 21.5
let y = -x
// y == -21.5</code></pre>

<p><strong><code>operand</code>:</strong>  The value to negate.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">prefix func -(x: Double) -&gt; Double</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-mns_-float">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-mns_-float">prefix func -(<wbr>_: Float)</a>
        
<div class="comment collapse" id="comment-func-mns_-float"><div class="p">
    <p>Calculates the additive inverse of a value.</p>

<p>The unary minus operator (prefix <code>-</code>) calculates the negation of its
operand. The result is always exact.</p>

<pre><code class="language-swift">let x = 21.5
let y = -x
// y == -21.5</code></pre>

<p><strong><code>operand</code>:</strong>  The value to negate.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">prefix func -(x: Float) -&gt; Float</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-mns_-float80">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-mns_-float80">prefix func -(<wbr>_: Float80)</a>
        
<div class="comment collapse" id="comment-func-mns_-float80"><div class="p">
    <p>Calculates the additive inverse of a value.</p>

<p>The unary minus operator (prefix <code>-</code>) calculates the negation of its
operand. The result is always exact.</p>

<pre><code class="language-swift">let x = 21.5
let y = -x
// y == -21.5</code></pre>

<p><strong><code>operand</code>:</strong>  The value to negate.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">prefix func -(x: Float80) -&gt; Float80</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/Float80/"><code>Float80</code></a>,    <a href="../../protocol/BinaryFloatingPoint/"><code>BinaryFloatingPoint</code></a>,    <a href="../../protocol/SignedNumeric/"><code>SignedNumeric</code></a>    
</div></div>
</div>
